{% extends "base.html" %}
{% load i18n %}
{% if rss != 0 %}
    {% block rss %}
        <link rel="alternate" href="{{ rss }}" type="application/rss+xml" title="">
    {% endblock %}
{% endif %}
{% block title %}
{% if title %} {% if title == 'answer' %}Вопросы и ответы{% else %} {{ title }}{% endif %}{% endif %}
{% endblock %}
{% block content %}
<div class='post_list'>
<div class="post_list_head">
    {% if post_type == 'auth' %}
        <span class="left">{% trans "Posts by " %} <a href='/user/{{ subject.user }}/'><img src='{{ subject.user.get_profile.get_avatar }}' class='mini_av' /> {{ subject.user }}</a></span>
            {% if request.user.is_authenticated and subject.user != request.user %}
                <span class="right">{% if option == 0 %}
                <a id='add_friend' href="/action/friend/{{ subject.user }}/">{% trans "Add to friends!" %}</a>
                {% endif %}
                {% if option == 1 %}
                    <a id='remove_friend' href="/action/friend/{{ subject.user }}/">{% trans "Remove from friends!" %}</a>
                {% endif %}</span>
            {% endif %}
    {% endif %}
    {% if post_type == 'blog' %}
        <span class="left">{% trans "Posts in " %} <a href='/blog/{{ subject.id }}/'><img src='{{ subject.get_avatar }}' class='mini_av' /> {{ subject.name }}</a></span>
            {% if request.user.is_authenticated %}
                <span id='blog_rate' class="right">{% if option == 0 %}
                <a id='join_blog' href="/action/join/{{ subject.id }}/">{% trans "Invite!" %}</a>
                {% endif %}
                {% if option == 1 %}
                    <a id='leave_blog' href="/action/join/{{ subject.id }}/">{% trans "Get out!" %}</a>
                {% endif %}
                <a class="plus_rate rate_blog" href='/action/rateblog/{{ subject.id }}/1/'>+</a>
                <span
                {% if subject.rate > 0 %}
                    class='plus_rate'
                {% endif %}{% if subject.rate < 0 %}
                    class='minus_rate'
                {% endif %}>
                    {{ subject.rate }}
                </span>
            <a class="minus_rate rate_blog" href='/action/rateblog/{{ subject.id }}/0/'>-</a>
                </span>
            {% endif %}
    {% endif %}
    {% if post_type == 'tag' %}
        <span>{% trans "Posts with tag " %} <a href="/tag/{{ subject }}/">{{ subject }}</a></span>
    {% endif %}
    {% if post_type == 'favourite' %}
        <span>{% trans "Your favourite posts!" %}</span>
    {% endif %}
    {% if post_type == 'like' %}
        <span>{% trans "Posts like" %}
            {% if post.blog %}
            <a href="/blog/{{ subject.blog.id }}/">
                {% if subject.blog.get_avatar %}
                {% endif %}
                {{ subject.blog }}</a>
            {% else %}
                <a href="/user/{{ subject.author }}/">
                {{ subject.author }}</a>
            {% endif %}  — <a href="/post/{{ subject.id }}/">{{ subject.title }}</a>
        </span>
    {% endif %}
    {% if is_qa %}
        <span class='left'>
            {% trans 'Questions' %}: 
            <a href="/{{ post_type }}/" {% if not param %}class='selected_type'{% endif %}>{% trans "All" %}</a> /
            <a href="/{{ post_type }}/solved/" {% if param == 'solved' %}class='selected_type'{% endif %}>{% trans "Solved" %}</a> /
            <a href="/{{ post_type }}/unsolved/"  {% if param == 'unsolved' %}class='selected_type'{% endif %}>{% trans "Unsolved" %}</a>
        </span>
    {% endif %}
</div>
{% for post in object_list %}
<div class='post'>
    {% include 'post_item.html' %}
    <div class="post_bottom">
        {% if post.type < 3 and post.have_cut or post.type == 1 %}
            <div class="post_full"><a href="/post/{{ post.id }}/">{% trans "Show full." %}</a></div>
        {% endif %}
        {% load post %}
       {% include "post_rate.html" %}
        <a href='/post/{{ post.id }}/#comment' class='post_rate'>{% comments_count %}</a>
    </div>
</div>
{% endfor %}
</div>
<div class='paginator'>
    {% include "paginator_digg.html" %}
</div>
{% endblock %}
